<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller
{
    public function login()
    {
        $username = $_GET['name'];
        $password = $_GET['password'];
        $info = D('User')->where(array('account' => $username))->find();
        if ($info) {
            if ($info['password'] == $password) {
                $data['code'] = '1';
                $data['msg'] = '登录成功';
            } else {
                $data['code'] = '-1';
                $data['msg'] = '密码错误';
            }
        } else {
            $data['code'] = '-2';
            $data['msg'] = '用户不存在';
        }
        echo json_encode($data);
    }
}
